<h2>Proposições - <?php echo $camara->name; ?></h2>

<table>
  <thead>
    <tr>
	  <th>Proposi&ccedil;&atilde;o</th>
	  <th>Descri&ccedil;&atilde;o</th>
	  <th>C&acirc;mara</th>
	  <th>Tema</th>
	  <th>Limite conclus&atilde;o</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($pager->getResults() as $i => $proposicao): ?>
		<?php 
		if(strtotime($proposicao->getDtLimiteConclusao()) < strtotime('-1 day')): //se não: venceu?
		    $flag = "blue";
			$alt_title = 'alt=vencida title=vencida';
			  elseif(strtotime($proposicao->getDtLimiteConclusao()) < strtotime('+3 day')): //se não: falta 3 dias?
		      $flag = "yellow";
				  $alt_title = 'alt=vence em 3 dias title=vence em 3 dias';
			    else:
		      $flag = "green";
			  $alt_title = 'alt=vence após 3 dias title=vence após 3 dias';
		endif;
		?>		
    <tr class="<?php echo fmod($i, 2) ? 'even' : 'odd' ?>">
      <td><?php echo link_to("&nbsp;".image_tag('flags/'.$flag.'.gif', $alt_title) ."&nbsp;". $proposicao->getName(), 'proposicao_show', $proposicao) ?></td>
      <td><?php echo link_to($proposicao->getDeProposicao(), 'proposicao_show', $proposicao) ?></td>
      <td><?php echo $proposicao->getCamara() ?></td>
      <td><?php echo $proposicao->getCdTema() > 1 ? html_entity_decode($proposicao->getTema()) : '<small>< aguardando tema ></small>' ?></td>
      <td><?php echo date('d/m/Y',strtotime($proposicao->getDtLimiteConclusao())) ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<?php if ($pager->haveToPaginate()): ?>
<div class="div_center" >
	<div class="pagination">
    <a href="<?php echo url_for('proposicao/index') ?>?page=1">
      <?php echo image_tag('first.png', 'alt="Primeira página" title="Primeira página"')?>
    </a>
 
    <a href="<?php echo url_for('proposicao/index') ?>?page=<?php echo $pager->getPreviousPage() ?>">
      <?php echo image_tag('previous.png', 'alt="Voltar" title="Voltar"')?>
    </a>
 
    <?php foreach ($pager->getLinks() as $page): ?>
      <?php if ($page == $pager->getPage()): ?>
        <?php echo $page ?>
      <?php else: ?>
        <a href="<?php echo url_for('proposicao/index') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
      <?php endif; ?>
    <?php endforeach; ?>
 
    <a href="<?php echo url_for('proposicao/index') ?>?page=<?php echo $pager->getNextPage() ?>">
      <?php echo image_tag('next.png', 'alt="Próxima" title="Próxima"')?>
    </a>
 
    <a href="<?php echo url_for('proposicao/index') ?>?page=<?php echo $pager->getLastPage() ?>">
      <?php echo image_tag('last.png', 'alt="Última página" title="Última página"')?>
    </a>
	</div>
</div>
<?php endif; ?>

<p><?php echo button_to('Nova','proposicao/new','class="btn"') ?>&nbsp;
<a href="<?php echo url_for($sf_user->getAttribute('show_proposicoes_page',null,'usr')) ?>" class="link_btn">Voltar</a>

<p><?php include_partial('proposicao/legendaProposicoes') ?></p>